package com.thoughtworks.preuniversity.biblioteca;

/**
 * Created by padmavb on 6/12/14.
 */
public class Book {

    private String bookTitle;
    private String authorName;
    private int publishedYear;
    public Book(String bookTitle,String authorName,int publishedYear){

        this.bookTitle=bookTitle;
        this.authorName=authorName;
        this.publishedYear=publishedYear;
    }

    public String getTitle() {
        return bookTitle;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Book book = (Book) o;

        if (publishedYear != book.publishedYear) return false;
        if (!authorName.equals(book.authorName)) return false;
        if (!bookTitle.equals(book.bookTitle)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = bookTitle.hashCode();
        result = 31 * result + authorName.hashCode();
        result = 31 * result + publishedYear;
        return result;
    }

    public int getPublishedYear() {
        return publishedYear;
    }

    public String getAuthorName() {
        return authorName;
    }
}
